#include <stdio.h>

/**
 * if else 语句
 * 三目运算符
 */
int main() {
	// 收入，支出，储蓄，亏损，利益
	double income, expenses, savings, deficit, interest;
	printf("Enter your income and expenses:\n");
	scanf("%lf %lf", &income, &expenses);
	printf("\n\n");

	// 流程控制
	if (income > expenses) {
		savings = income - expenses;
		printf("You are saving money. \n"
			   "Your savings for this month are : $%lf,\n", savings);
	}
	else {
		deficit = expenses - income;
		printf("You are running a deficit.\n"
			   "Your deficit for this month is : $%lf,\n", deficit);
	}

	// 三目运算符
	interest = (deficit > 0.0) ? (0.05 * deficit) : 0.0;
	printf("The interest you owe on your debt is : $%lf,\n", interest);
}